<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--1.引入bootstrap样式框架；-->
    <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">

    <!--2.引入angularJS分页样式的框架；-->
    <link rel="stylesheet" href="../angularjs/pagination.css">

    <link rel="stylesheet" href="../layer/theme/default/layer.css">

    <!--3.引入bootstrap中的Jquery框架；-->
    <script src="../bootstrap/js/jquery.min.js"></script>
    <!--4.引入bootstrap中的Js框架；-->
    <script src="../bootstrap/js/bootstrap.min.js"></script>

    <!--5.引入AngularJS的JS框架-->
    <script src="../angularjs/angular.min.js"></script>

    <!--6.引入AngularJS分布的JS框架-->
    <script src="../angularjs/pagination.js"></script>

    <script src="../layer/layer.js"></script>

    <script src="../angularjs/angular-route.min.js"></script>
    <script src="../angularjs/angular-animate.min.js"></script>

</head>
<body ng-app="reApp"    ng-controller="reCtrl">

<!--最上方小导航栏-->
<div ng-include=" 'obtop.html' "></div>

<!--主要导航栏-->
<div class="navbar navbar-default " role="navigation" style="background-color: white;height: 80px;margin-bottom: 0px;padding-top: 15px">
    <!--navbar-fixed-top-->
    <div class="navbar-header" style="padding-left: 30px;">
        <a class="navbar-brand" href="#" style="padding-top: 0px;padding-left: 150px;">
            <img alt="Brand" src="../imgs/oblogo.png" width="150" height="45">
        </a>

        <a class="navbar-brand" href="#" style="padding-top: 8px">
            <img alt="Brand" src="../imgs/ipv6.png" width="50" height="30">
        </a>
    </div>

    <ul class="nav navbar-nav navbar-right" style="font-size: 15px;font-family:'黑体';padding-right: 150px">
        <li ><a href="../onlinebank.html">首页</a></li>
        <li ><a href="#!/login2">产品中心</a></li>
        <li ><a href="#!/login">安全保障</a></li>
        <li ><a href="obtransfer.html">账户转账</a></li>
        <li ><a href="obdetail.html">账户详情</a></li>&nbsp;&nbsp;&nbsp;&nbsp;
    </ul>
</div>


<div class="">

    <div class="panel panel-danger">

        <div class="panel-heading">
            <h1>欢迎进入系统--注册</h1>

        </div>

        <div class="panel-body">
            <div class="col-md-9 col-md-offset-1">
                <form  action="/users/users/register" method="post">

                    <div class="form-group">
                        <div class="form-horizontal">
                            <label for="uname" class="control-label col-md-2">用户名</label>
                            <div class="input-group">
                                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
                                <input name="uname" id="uname" ng-model="form.uname" class="form-control" placeholder="请输入用户名" maxlength="30"
                                       type="text"><span id="yhk"></span>
                            </div>
                        </div>

                        <br>
                        <div class="form-horizontal">
                            <label for="upwd" class="control-label col-md-2">密码</label>
                            <div class="input-group">
                                <span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
                                <input name="upwd" id="upwd" ng-model="form.upwd" class="form-control" placeholder="请输入密码" maxlength="30"
                                       type="password">
                            </div>
                        </div>


                        <br>
                        <div class="form-group">
                            <div class="form-group">
                                <input class="btn btn-warning col-sm-offset-2 col-md-6" id="submit"
                                       ng-click="register()" value="注&nbsp;&nbsp;册"     type="button">
                            </div>
                            <div class="form-group">
                                <a class="btn btn-primary col-sm-offset-2 col-md-2" id="submit1"
                                   href="login.html" type="button">立即登录</a>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>

        <div class="panel-footer text-right">
            订单新系统
        </div>

    </div>

</div>

<script>
    layerindex=-1;
    var app = angular.module('reApp',['pagination','ngRoute']);    //定义一个模块； cityApp
    app.constant('uid', "");
    app.controller("reCtrl",function ($scope, $http) {    //定义一个控制器； cityCtrl  ,  $http 调用接口！  http://localhost:8080/citys/list.action
        $scope.id=0;

        $scope.form={
            uname:"",
            upwd:""
        }
        var sessionStorage = window.sessionStorage;
        $scope.register=function () {
            //layerindex = layer.load(1);  //1：代表动画加载；！！！！
            $http.post("/users/users/register",$.param({uname: $scope.form.uname, upwd: $scope.form.upwd}),
                {headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'}}
            ).success(function (data) {
                if(data.code==200){
                    console.log(data.msg)
                    console.log(data)

                    window.location.href="/login.html";
                    layer.close(layerindex);
                    layer.msg("注册成功！",{icon:6,title:"系统提示："});
                }else{
                    console.log(data.msg)
                }
            })
        }

    });

</script>
</body>
</html>